﻿using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        { 
            // 加载导航控件
            InitDaoHang();
        }
    }

    private void InitDaoHang()
    {
        DDS.WebControls.PanelBar panelBar = new DDS.WebControls.PanelBar("panBar");
        DataTable groups = new dds_navigationgroup().GetNavigationGroup();
        foreach (DataRow groupRow in groups.Rows)
        {
            int groupID = Convert.ToInt32(groupRow["navigationgroupid"]);

            DDS.WebControls.PanelBarGroup palGroup = new DDS.WebControls.PanelBarGroup();
            palGroup.Text = groupRow["text"].ToString();
            palGroup.NavigateUrl = groupRow["navigateUrl"].ToString();
            DataTable items = new dds_navigationitem().GetNavigationItemsByGroupID(groupID);
            foreach (DataRow itemRow in items.Rows)
            {
                DDS.WebControls.PanelBarItem palItem = new DDS.WebControls.PanelBarItem();
                palItem.Text = itemRow["text"].ToString();
                palItem.NavigateUrl = itemRow["navigateUrl"].ToString();
                palItem.Target = itemRow["target"].ToString();
                palGroup.PanelBarItems.Add(palItem);
            }

            panelBar.PanelBarGroups.Add(palGroup);
        }


        this.divLeft.InnerHtml = (panelBar.DataBind());
    }
}
